package pl.maciejziarko.mshare.web.mvc;

import org.springframework.ui.Model;
import pl.maciejziarko.mshare.utils.Check;

/**
 * @author Maciej Ziarko
 */
final class Redirect {
    
    private static final String PREFIX = "redirect:";

    public static final String HOME = "/";

    public static final String LOGIN = "/login";
    
    public static final String APP_ERROR = "/error";

    public static String toLocation(String location, Model model) {
        Check.notNull(model, "Model cannot be null");

        model.asMap().clear();
        return toLocation(location);
    }
    
    public static String toLocation(String location) {
        return PREFIX + location;
    }
}
